module ApplicationHelper

  def i_with_span_text(text, iclass, sclass = '')
    content_tag(:i, nil, class: iclass) + content_tag(:span, text, class: sclass)
  end

  def i_with_text(text, iclass)
    content_tag(:i, nil, class: iclass) + text
  end

  def fa_i(which)
    content_tag(:i, nil, class: "fa fa-#{which}")
  end

  def fa_i_with_text(text, which, sclass = '')
    content_tag(:i, nil, class: "fa fa-#{which}") + content_tag(:span, text, class: sclass)
  end

  def fa_with_link(text, path, options = {})
    fa = options.delete :i
    _text = if fa.blank?
              text
            else
              fa_icon(fa) << text
            end
    link_to _text, path, options
  end
end
